/**
 * Created by Administrator on 2017/6/10 0010.
 */

$('#subLogin').click(function () {
    var login = $('#login')
    $.get(BASE_URL + "/api/admin/login/", login.serialize(), function (msg) {
        if(msg.code == 0){
        	console.log(msg.code)
            setCookie("token", msg.data.token);
            setCookie("name", msg.data.name);
            location.href='admin.html'
        }
        else if ($('#txtUserName').val() == "") {
            alert('请输入用户名!')
        }
        else if ($('#txtPWD').val() == "") {
            alert('请输入密码!')
        }
        else{
            alert('密码或用户名错误!')
        }
    })
})

